<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/init.jsp"%>
<html>
<head>
<title>澳斯浪廷会员平台</title>
<link href="<c:url value='/resources/css/css.css'/>" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.7.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/mask.js'/>"></script>
</head>
<body leftmargin="0">
<div class="main">
<div class="width_l">
    <iframe src="menu.action" frameborder="0" width="250" height="100%" class="menu"></iframe>
</div>    
    <div class="right">
  <div class="width_r">
        <div class="menu_r">
            <ul>
                <li><a href="index.action">首页</a></li>
                <li><a href="information.action">消息</a></li>
                <li><a href="notice.action">公告中心</a></li>
                <li><a href="news.action">新闻中心</a></li>
                <li><a href="inbox.action">收件箱</a></li>
                <li><a href="tomail.action">写邮件</a></li>
                <li><a href="sent.action">已发送</a></li>
                <li><a href="${ctx}/exit.action">安全退出</a></li> 
            </ul>
        </div>
        <div class="news_top"><img src="<c:url value='/resources/images/top.jpg'/>" /></div>
        <div class="news">
            <h4>会员升级</h4>
          <div class="shengji">升级选择</div>
          <div class="sjxz">现在级别：<input type="hidden" id="nowlevel" value="${user.level}"/>
          	<c:forEach var="level" items="${levelList }">
            	<c:if test="${level.code eq user.level}">${level.name }</c:if>
            </c:forEach> 
            <span>
            	<c:forEach begin="1" end="${user.level}">
            		<img src="<c:url value='/resources/images/star.jpg'/>"/> 
            	</c:forEach>
                <c:if test="${user.level <'5' }">
                	<c:forEach begin="${user.level + 1 }" end="5">
                		<img src="<c:url value='/resources/images/star_h.jpg'/>"/> 
                	</c:forEach>
                </c:if>
             </span>
          </div>
            <div class="sj">升级级别：
	            <select id="tolevel">
	              <c:forEach var="level" items="${levelList }">
	            	<c:if test="${level.code gt user.level}">
	            		<option value="${level.code }">${level.name }</option>
	            	</c:if>
	              </c:forEach>
	            </select>
            </div>
            <div class="tijiao"><img src="<c:url value='/resources/images/tijiao.jpg'/>" onclick="uplevel();"/></div>
        </div>
        <div class="news_down"><img src="<c:url value='/resources/images/down.jpg'/>" /></div>
    </div>
    </div>
</div>

</body>
</html>
<script type="text/javascript">
function uplevel(){
	var nowlevel = $("#nowlevel").val();
	if(nowlevel == '5'){
		alert("当前级别为最高级，不能升级 ");
		return ;
	}
	$(document).mask("系统处理中，请稍后......");
	$.ajax({
		type: 'POST',
		url: "${ctx}/uplevel.action",
		data: "tolevel="+$("#tolevel").val(),
		dataType: "html",
		success: function(data,status){
			alert(data);
			$(window.location).attr('href', "${ctx}/promote.action");
		},
		error: function(data,status,e){
			alert(e.name);
		}
	});
}
</script>